Expand description
Python AST node definitions and utilities.
AST nodes are very similary defined like Python AST. But a few exceptions exist due to parser optimization. They can be transformed to matching Python-styled AST in reasonable cost.
PythonArguments is replaced by Arguments. The new Arguments type representation uses a new type ArgWithDefault to represent arguments with default values. See each type documentation for more details.
A few top-level sum types are renamed to human friendly names.
CmpOp refers cmpop
UnaryOp refers unaryop
BoolOp refers boolop
WithItem refers withitem
ExceptHandler refers excepthandler
Re-exports§
pub use fold::Fold;
pub use crate::Node;
pub use malachite_bigint as bigint;
Modules§
- fold
- located
- source_
code - text_
size - Newtypes for working with text sizes/ranges in a more type-safe manner.
Structs§
- Alias
- See also alias
- Arg
- See also arg
- ArgWith
Default - An alternative type of AST
arg
. This is used for each function argument that might have a default value. Used byArguments
original type. - Arguments
- An alternative type of AST
arguments
. This is parser-friendly and human-friendly definition of function arguments. This form also has advantage to implement pre-order traverse.defaults
andkw_defaults
fields are removed and the default values are placed under eacharg_with_default
typed argument.vararg
andkwarg
are still typed asarg
because they never can have a default value. - Bool
OpAnd - Bool
OpOr - CmpOpEq
- CmpOpGt
- CmpOp
GtE - CmpOpIn
- CmpOpIs
- CmpOp
IsNot - CmpOpLt
- CmpOp
LtE - CmpOp
NotEq - CmpOp
NotIn - Comprehension
- See also comprehension
- Empty
Range - Except
Handler Except Handler - See also ExceptHandler
- Expr
Attribute - See also Attribute
- Expr
Await - See also Await
- Expr
BinOp - See also BinOp
- Expr
Bool Op - See also BoolOp
- Expr
Call - See also Call
- Expr
Compare - See also Compare
- Expr
Constant - See also Constant
- Expr
Context Del - Expr
Context Load - Expr
Context Store - Expr
Dict - See also Dict
- Expr
Dict Comp - See also DictComp
- Expr
Formatted Value - See also FormattedValue
- Expr
Generator Exp - See also GeneratorExp
- Expr
IfExp - See also IfExp
- Expr
Joined Str - See also JoinedStr
- Expr
Lambda - See also Lambda
- Expr
List - See also List
- Expr
List Comp - See also ListComp
- Expr
Name - See also Name
- Expr
Named Expr - See also NamedExpr
- ExprSet
- See also Set
- Expr
SetComp - See also SetComp
- Expr
Slice - See also Slice
- Expr
Starred - See also Starred
- Expr
Subscript - See also Subscript
- Expr
Tuple - See also Tuple
- Expr
Unary Op - See also UnaryOp
- Expr
Yield - See also Yield
- Expr
Yield From - See also YieldFrom
- Identifier
- Int
- Keyword
- See also keyword
- Match
Case - See also match_case
- ModExpression
- See also Expression
- ModFunction
Type - See also FunctionType
- ModInteractive
- See also Interactive
- ModModule
- See also Module
- Operator
Add - Operator
BitAnd - Operator
BitOr - Operator
BitXor - Operator
Div - Operator
Floor Div - OperatorL
Shift - Operator
MatMult - Operator
Mod - Operator
Mult - Operator
Pow - OperatorR
Shift - Operator
Sub - Pattern
Match As - See also MatchAs
- Pattern
Match Class - See also MatchClass
- Pattern
Match Mapping - See also MatchMapping
- Pattern
Match Or - See also MatchOr
- Pattern
Match Sequence - See also MatchSequence
- Pattern
Match Singleton - See also MatchSingleton
- Pattern
Match Star - See also MatchStar
- Pattern
Match Value - See also MatchValue
- Python
Arguments - See also arguments
- Stmt
AnnAssign - See also AnnAssign
- Stmt
Assert - See also Assert
- Stmt
Assign - See also Assign
- Stmt
Async For - See also AsyncFor
- Stmt
Async Function Def - See also AsyncFunctionDef
- Stmt
Async With - See also AsyncWith
- Stmt
AugAssign - See also AugAssign
- Stmt
Break - See also Break
- Stmt
Class Def - See also ClassDef
- Stmt
Continue - See also Continue
- Stmt
Delete - See also Delete
- Stmt
Expr - See also Expr
- StmtFor
- See also For
- Stmt
Function Def - See also FunctionDef
- Stmt
Global - See also Global
- StmtIf
- See also If
- Stmt
Import - See also Import
- Stmt
Import From - See also ImportFrom
- Stmt
Match - See also Match
- Stmt
Nonlocal - See also Nonlocal
- Stmt
Pass - See also Pass
- Stmt
Raise - See also Raise
- Stmt
Return - See also Return
- StmtTry
- See also Try
- Stmt
TryStar - See also TryStar
- Stmt
Type Alias - See also TypeAlias
- Stmt
While - See also While
- Stmt
With - See also With
- Text
Size - A measure of text length. Also, equivalently, an index into text.
- Type
Ignore Type Ignore - See also TypeIgnore
- Type
Param Param Spec - See also ParamSpec
- Type
Param Type Var - See also TypeVar
- Type
Param Type VarTuple - See also TypeVarTuple
- Unary
OpInvert - Unary
OpNot - Unary
OpUAdd - Unary
OpUSub - With
Item - See also withitem
Enums§
- Ast
- BoolOp
- See also boolop
- CmpOp
- See also cmpop
- Constant
- Conversion
Flag - Transforms a value prior to formatting it.
- Except
Handler - See also excepthandler
- Expr
- See also expr
- Expr
Context - See also expr_context
- Mod
- See also mod
- Operator
- See also operator
- Pattern
- See also pattern
- Stmt
- See also stmt
- Type
Ignore - See also type_ignore
- Type
Param - See also type_param
- UnaryOp
- See also unaryop